package com.unicom.projt.util;

/**
 * Created by IntelliJ IDEA.
 * User: Lee
 * Date: 11-12-29
 * Time: 下午2:05
 */
public class StringUtils {
    public static String fenToYuan(String fen){
        if(fen.length()<2){
            return "0.0"+fen;
        }
        if(fen.length()<3){
            return "0."+fen;
        }
        String yuan=fen.substring(0,fen.length()-2);
        String lastTwoChar=fen.substring(fen.length()-2);
        return yuan+"."+lastTwoChar;
    }

    public static String liToYuan(String li){
        if(li.length()<2){
            return "0.00";
        }
        if(li.length()<3){
            return "0.0"+li.substring(0,1);
        }
        if(li.length()<4){
            return "0."+li.substring(0,2);
        }
        String yuan=li.substring(0,li.length()-3);
        String lastTwoChar=li.substring(li.length()-3);
        return yuan+"."+lastTwoChar.substring(0,2);
    }
}
